
'===============================================================================
'  Generated From - VbNet_SQL_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  **
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.3.0.3)

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

NameSpace Class_RC

Public MustInherit Class _RANGODOCUMENTOS
	Inherits SqlClientEntity

		Public Sub New() 
			Me.QuerySource = "RANGODOCUMENTOS"
			Me.MappingName = "RANGODOCUMENTOS"
		End Sub

	'=================================================================
	'  Public Overrides Sub AddNew()
	'=================================================================
	'
	'=================================================================
	Public Overrides Sub AddNew()
		MyBase.AddNew()
				
	End Sub
	
	Public Overrides Sub FlushData()
		Me._whereClause = nothing
		Me._aggregateClause = nothing		
		MyBase.FlushData()
	End Sub
	
		
	'=================================================================
	'  	Public Function LoadAll() As Boolean
	'=================================================================
	'  Loads all of the records in the database, and sets the currentRow to the first row
	'=================================================================
	Public Function LoadAll() As Boolean
	
		Dim parameters As ListDictionary = Nothing
		
		
    	Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_RANGODOCUMENTOSLoadAll]", parameters)
		
	End Function

	'=================================================================
	' Public Overridable Function LoadByPrimaryKey()  As Boolean
	'=================================================================
	'  Loads a single row of via the primary key
	'=================================================================
        Public Overridable Function LoadByPrimaryKey(ByVal IdDocumento As Integer) As Boolean

            Dim parameters As ListDictionary = New ListDictionary()
            parameters.Add(_RANGODOCUMENTOS.Parameters.IdDocumento, IdDocumento)


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_RANGODOCUMENTOSLoadByPrimaryKey]", parameters)

        End Function

#Region "Parameters"
        Protected Class Parameters

            Public Shared ReadOnly Property IdDocumento As SqlParameter
                Get
                    Return New SqlParameter("@IdDocumento", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property TipoDocumento As SqlParameter
                Get
                    Return New SqlParameter("@TipoDocumento", SqlDbType.NVarChar, 50)
                End Get
            End Property

            Public Shared ReadOnly Property RangoInicio As SqlParameter
                Get
                    Return New SqlParameter("@RangoInicio", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property RangoFin As SqlParameter
                Get
                    Return New SqlParameter("@RangoFin", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property RangoActual As SqlParameter
                Get
                    Return New SqlParameter("@RangoActual", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodUsuario As SqlParameter
                Get
                    Return New SqlParameter("@CodUsuario", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property FechaActualizacion As SqlParameter
                Get
                    Return New SqlParameter("@FechaActualizacion", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Habilitado As SqlParameter
                Get
                    Return New SqlParameter("@Habilitado", SqlDbType.Bit, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Vto As SqlParameter
                Get
                    Return New SqlParameter("@Vto", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Prefijo As SqlParameter
                Get
                    Return New SqlParameter("@Prefijo", SqlDbType.NVarChar, 50)
                End Get
            End Property

        End Class
#End Region

#Region "ColumnNames"
        Public Class ColumnNames

            Public Const IdDocumento As String = "idDocumento"
            Public Const TipoDocumento As String = "tipoDocumento"
            Public Const RangoInicio As String = "rangoInicio"
            Public Const RangoFin As String = "rangoFin"
            Public Const RangoActual As String = "rangoActual"
            Public Const CodUsuario As String = "codUsuario"
            Public Const FechaActualizacion As String = "fechaActualizacion"
            Public Const Habilitado As String = "habilitado"
            Public Const Vto As String = "vto"
            Public Const Prefijo As String = "prefijo"

            Public Shared Function ToPropertyName(ByVal columnName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(IdDocumento) = _RANGODOCUMENTOS.PropertyNames.IdDocumento
                    ht(TipoDocumento) = _RANGODOCUMENTOS.PropertyNames.TipoDocumento
                    ht(RangoInicio) = _RANGODOCUMENTOS.PropertyNames.RangoInicio
                    ht(RangoFin) = _RANGODOCUMENTOS.PropertyNames.RangoFin
                    ht(RangoActual) = _RANGODOCUMENTOS.PropertyNames.RangoActual
                    ht(CodUsuario) = _RANGODOCUMENTOS.PropertyNames.CodUsuario
                    ht(FechaActualizacion) = _RANGODOCUMENTOS.PropertyNames.FechaActualizacion
                    ht(Habilitado) = _RANGODOCUMENTOS.PropertyNames.Habilitado
                    ht(Vto) = _RANGODOCUMENTOS.PropertyNames.Vto
                    ht(Prefijo) = _RANGODOCUMENTOS.PropertyNames.Prefijo

                End If

                Return CType(ht(columnName), String)

            End Function

            Private Shared ht As Hashtable = Nothing
        End Class
#End Region

#Region "PropertyNames"
        Public Class PropertyNames

            Public Const IdDocumento As String = "IdDocumento"
            Public Const TipoDocumento As String = "TipoDocumento"
            Public Const RangoInicio As String = "RangoInicio"
            Public Const RangoFin As String = "RangoFin"
            Public Const RangoActual As String = "RangoActual"
            Public Const CodUsuario As String = "CodUsuario"
            Public Const FechaActualizacion As String = "FechaActualizacion"
            Public Const Habilitado As String = "Habilitado"
            Public Const Vto As String = "Vto"
            Public Const Prefijo As String = "Prefijo"

            Public Shared Function ToColumnName(ByVal propertyName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(IdDocumento) = _RANGODOCUMENTOS.ColumnNames.IdDocumento
                    ht(TipoDocumento) = _RANGODOCUMENTOS.ColumnNames.TipoDocumento
                    ht(RangoInicio) = _RANGODOCUMENTOS.ColumnNames.RangoInicio
                    ht(RangoFin) = _RANGODOCUMENTOS.ColumnNames.RangoFin
                    ht(RangoActual) = _RANGODOCUMENTOS.ColumnNames.RangoActual
                    ht(CodUsuario) = _RANGODOCUMENTOS.ColumnNames.CodUsuario
                    ht(FechaActualizacion) = _RANGODOCUMENTOS.ColumnNames.FechaActualizacion
                    ht(Habilitado) = _RANGODOCUMENTOS.ColumnNames.Habilitado
                    ht(Vto) = _RANGODOCUMENTOS.ColumnNames.Vto
                    ht(Prefijo) = _RANGODOCUMENTOS.ColumnNames.Prefijo

                End If

                Return CType(ht(propertyName), String)

            End Function

            Private Shared ht As Hashtable = Nothing

        End Class
#End Region

#Region "StringPropertyNames"
        Public Class StringPropertyNames

            Public Const IdDocumento As String = "s_IdDocumento"
            Public Const TipoDocumento As String = "s_TipoDocumento"
            Public Const RangoInicio As String = "s_RangoInicio"
            Public Const RangoFin As String = "s_RangoFin"
            Public Const RangoActual As String = "s_RangoActual"
            Public Const CodUsuario As String = "s_CodUsuario"
            Public Const FechaActualizacion As String = "s_FechaActualizacion"
            Public Const Habilitado As String = "s_Habilitado"
            Public Const Vto As String = "s_Vto"
            Public Const Prefijo As String = "s_Prefijo"

        End Class
#End Region

#Region "Properties"
        Public Overridable Property IdDocumento As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdDocumento)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdDocumento, Value)
            End Set
        End Property

        Public Overridable Property TipoDocumento As String
            Get
                Return MyBase.Getstring(ColumnNames.TipoDocumento)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.TipoDocumento, Value)
            End Set
        End Property

        Public Overridable Property RangoInicio As Integer
            Get
                Return MyBase.Getint(ColumnNames.RangoInicio)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.RangoInicio, Value)
            End Set
        End Property

        Public Overridable Property RangoFin As Integer
            Get
                Return MyBase.Getint(ColumnNames.RangoFin)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.RangoFin, Value)
            End Set
        End Property

        Public Overridable Property RangoActual As Integer
            Get
                Return MyBase.Getint(ColumnNames.RangoActual)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.RangoActual, Value)
            End Set
        End Property

        Public Overridable Property CodUsuario As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodUsuario)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodUsuario, Value)
            End Set
        End Property

        Public Overridable Property FechaActualizacion As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.FechaActualizacion)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.FechaActualizacion, Value)
            End Set
        End Property

        Public Overridable Property Habilitado As Boolean
            Get
                Return MyBase.Getbool(ColumnNames.Habilitado)
            End Get
            Set(ByVal Value As Boolean)
                MyBase.Setbool(ColumnNames.Habilitado, Value)
            End Set
        End Property

        Public Overridable Property Vto As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.Vto)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.Vto, Value)
            End Set
        End Property

        Public Overridable Property Prefijo As String
            Get
                Return MyBase.Getstring(ColumnNames.Prefijo)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.Prefijo, Value)
            End Set
        End Property


#End Region
	
	#Region "String Properties" 

		Public Overridable Property s_IdDocumento As String
			Get
				If Me.IsColumnNull(ColumnNames.IdDocumento) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdDocumento)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdDocumento)
				Else
					Me.IdDocumento = MyBase.SetintAsString(ColumnNames.IdDocumento, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_TipoDocumento As String
			Get
				If Me.IsColumnNull(ColumnNames.TipoDocumento) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.TipoDocumento)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.TipoDocumento)
				Else
					Me.TipoDocumento = MyBase.SetstringAsString(ColumnNames.TipoDocumento, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_RangoInicio As String
			Get
				If Me.IsColumnNull(ColumnNames.RangoInicio) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.RangoInicio)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.RangoInicio)
				Else
					Me.RangoInicio = MyBase.SetintAsString(ColumnNames.RangoInicio, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_RangoFin As String
			Get
				If Me.IsColumnNull(ColumnNames.RangoFin) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.RangoFin)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.RangoFin)
				Else
					Me.RangoFin = MyBase.SetintAsString(ColumnNames.RangoFin, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_RangoActual As String
			Get
				If Me.IsColumnNull(ColumnNames.RangoActual) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.RangoActual)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.RangoActual)
				Else
					Me.RangoActual = MyBase.SetintAsString(ColumnNames.RangoActual, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodUsuario As String
			Get
				If Me.IsColumnNull(ColumnNames.CodUsuario) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodUsuario)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodUsuario)
				Else
					Me.CodUsuario = MyBase.SetintAsString(ColumnNames.CodUsuario, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_FechaActualizacion As String
			Get
				If Me.IsColumnNull(ColumnNames.FechaActualizacion) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.FechaActualizacion)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.FechaActualizacion)
				Else
					Me.FechaActualizacion = MyBase.SetDateTimeAsString(ColumnNames.FechaActualizacion, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Habilitado As String
			Get
				If Me.IsColumnNull(ColumnNames.Habilitado) Then
					Return String.Empty
				Else
					Return MyBase.GetboolAsString(ColumnNames.Habilitado)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Habilitado)
				Else
					Me.Habilitado = MyBase.SetboolAsString(ColumnNames.Habilitado, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Vto As String
			Get
				If Me.IsColumnNull(ColumnNames.Vto) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.Vto)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Vto)
				Else
					Me.Vto = MyBase.SetDateTimeAsString(ColumnNames.Vto, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Prefijo As String
			Get
				If Me.IsColumnNull(ColumnNames.Prefijo) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.Prefijo)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Prefijo)
				Else
					Me.Prefijo = MyBase.SetstringAsString(ColumnNames.Prefijo, Value)
				End If
			End Set
		End Property


	#End Region  	

	#Region "Where Clause"
    Public Class WhereClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffWhereParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffWhereParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "TearOff's"
		Public class TearOffWhereParameter

			Public Sub New(ByVal clause As WhereClause)
				Me._clause = clause
			End Sub
		
	
			Public ReadOnly Property IdDocumento() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.IdDocumento, Parameters.IdDocumento)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property TipoDocumento() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.TipoDocumento, Parameters.TipoDocumento)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property RangoInicio() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.RangoInicio, Parameters.RangoInicio)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property RangoFin() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.RangoFin, Parameters.RangoFin)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property RangoActual() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.RangoActual, Parameters.RangoActual)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodUsuario() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodUsuario, Parameters.CodUsuario)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property FechaActualizacion() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.FechaActualizacion, Parameters.FechaActualizacion)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Habilitado() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Habilitado, Parameters.Habilitado)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Vto() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Vto, Parameters.Vto)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Prefijo() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Prefijo, Parameters.Prefijo)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property


			Private _clause as WhereClause
		End Class
		#End Region	

		Public ReadOnly Property IdDocumento() As WhereParameter 
			Get
				If _IdDocumento_W Is Nothing Then
					_IdDocumento_W = TearOff.IdDocumento
				End If
				Return _IdDocumento_W
			End Get
		End Property

		Public ReadOnly Property TipoDocumento() As WhereParameter 
			Get
				If _TipoDocumento_W Is Nothing Then
					_TipoDocumento_W = TearOff.TipoDocumento
				End If
				Return _TipoDocumento_W
			End Get
		End Property

		Public ReadOnly Property RangoInicio() As WhereParameter 
			Get
				If _RangoInicio_W Is Nothing Then
					_RangoInicio_W = TearOff.RangoInicio
				End If
				Return _RangoInicio_W
			End Get
		End Property

		Public ReadOnly Property RangoFin() As WhereParameter 
			Get
				If _RangoFin_W Is Nothing Then
					_RangoFin_W = TearOff.RangoFin
				End If
				Return _RangoFin_W
			End Get
		End Property

		Public ReadOnly Property RangoActual() As WhereParameter 
			Get
				If _RangoActual_W Is Nothing Then
					_RangoActual_W = TearOff.RangoActual
				End If
				Return _RangoActual_W
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As WhereParameter 
			Get
				If _CodUsuario_W Is Nothing Then
					_CodUsuario_W = TearOff.CodUsuario
				End If
				Return _CodUsuario_W
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As WhereParameter 
			Get
				If _FechaActualizacion_W Is Nothing Then
					_FechaActualizacion_W = TearOff.FechaActualizacion
				End If
				Return _FechaActualizacion_W
			End Get
		End Property

		Public ReadOnly Property Habilitado() As WhereParameter 
			Get
				If _Habilitado_W Is Nothing Then
					_Habilitado_W = TearOff.Habilitado
				End If
				Return _Habilitado_W
			End Get
		End Property

		Public ReadOnly Property Vto() As WhereParameter 
			Get
				If _Vto_W Is Nothing Then
					_Vto_W = TearOff.Vto
				End If
				Return _Vto_W
			End Get
		End Property

		Public ReadOnly Property Prefijo() As WhereParameter 
			Get
				If _Prefijo_W Is Nothing Then
					_Prefijo_W = TearOff.Prefijo
				End If
				Return _Prefijo_W
			End Get
		End Property

		Private _IdDocumento_W As WhereParameter = Nothing
		Private _TipoDocumento_W As WhereParameter = Nothing
		Private _RangoInicio_W As WhereParameter = Nothing
		Private _RangoFin_W As WhereParameter = Nothing
		Private _RangoActual_W As WhereParameter = Nothing
		Private _CodUsuario_W As WhereParameter = Nothing
		Private _FechaActualizacion_W As WhereParameter = Nothing
		Private _Habilitado_W As WhereParameter = Nothing
		Private _Vto_W As WhereParameter = Nothing
		Private _Prefijo_W As WhereParameter = Nothing

			Public Sub WhereClauseReset()

			_IdDocumento_W = Nothing
			_TipoDocumento_W = Nothing
			_RangoInicio_W = Nothing
			_RangoFin_W = Nothing
			_RangoActual_W = Nothing
			_CodUsuario_W = Nothing
			_FechaActualizacion_W = Nothing
			_Habilitado_W = Nothing
			_Vto_W = Nothing
			_Prefijo_W = Nothing
				Me._entity.Query.FlushWhereParameters()

			End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffWhereParameter
    End Class	

	Public ReadOnly Property Where() As WhereClause
		Get
			If _whereClause Is Nothing Then
				_whereClause = New WhereClause(Me)
			End If
	
			Return _whereClause
		End Get
	End Property
	
	Private _whereClause As WhereClause = Nothing	
#End Region	

#Region "Aggregate Clause"
    Public Class AggregateClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffAggregateParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffAggregateParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "AggregateParameter TearOff's"
		Public class TearOffAggregateParameter

			Public Sub New(ByVal clause As AggregateClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property IdDocumento() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdDocumento, Parameters.IdDocumento)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property TipoDocumento() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.TipoDocumento, Parameters.TipoDocumento)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property RangoInicio() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.RangoInicio, Parameters.RangoInicio)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property RangoFin() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.RangoFin, Parameters.RangoFin)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property RangoActual() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.RangoActual, Parameters.RangoActual)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodUsuario, Parameters.CodUsuario)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.FechaActualizacion, Parameters.FechaActualizacion)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Habilitado() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Habilitado, Parameters.Habilitado)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Vto() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Vto, Parameters.Vto)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Prefijo() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Prefijo, Parameters.Prefijo)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property


			Private _clause as AggregateClause
		End Class
		#End Region	

		Public ReadOnly Property IdDocumento() As AggregateParameter 
			Get
				If _IdDocumento_W Is Nothing Then
					_IdDocumento_W = TearOff.IdDocumento
				End If
				Return _IdDocumento_W
			End Get
		End Property

		Public ReadOnly Property TipoDocumento() As AggregateParameter 
			Get
				If _TipoDocumento_W Is Nothing Then
					_TipoDocumento_W = TearOff.TipoDocumento
				End If
				Return _TipoDocumento_W
			End Get
		End Property

		Public ReadOnly Property RangoInicio() As AggregateParameter 
			Get
				If _RangoInicio_W Is Nothing Then
					_RangoInicio_W = TearOff.RangoInicio
				End If
				Return _RangoInicio_W
			End Get
		End Property

		Public ReadOnly Property RangoFin() As AggregateParameter 
			Get
				If _RangoFin_W Is Nothing Then
					_RangoFin_W = TearOff.RangoFin
				End If
				Return _RangoFin_W
			End Get
		End Property

		Public ReadOnly Property RangoActual() As AggregateParameter 
			Get
				If _RangoActual_W Is Nothing Then
					_RangoActual_W = TearOff.RangoActual
				End If
				Return _RangoActual_W
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As AggregateParameter 
			Get
				If _CodUsuario_W Is Nothing Then
					_CodUsuario_W = TearOff.CodUsuario
				End If
				Return _CodUsuario_W
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As AggregateParameter 
			Get
				If _FechaActualizacion_W Is Nothing Then
					_FechaActualizacion_W = TearOff.FechaActualizacion
				End If
				Return _FechaActualizacion_W
			End Get
		End Property

		Public ReadOnly Property Habilitado() As AggregateParameter 
			Get
				If _Habilitado_W Is Nothing Then
					_Habilitado_W = TearOff.Habilitado
				End If
				Return _Habilitado_W
			End Get
		End Property

		Public ReadOnly Property Vto() As AggregateParameter 
			Get
				If _Vto_W Is Nothing Then
					_Vto_W = TearOff.Vto
				End If
				Return _Vto_W
			End Get
		End Property

		Public ReadOnly Property Prefijo() As AggregateParameter 
			Get
				If _Prefijo_W Is Nothing Then
					_Prefijo_W = TearOff.Prefijo
				End If
				Return _Prefijo_W
			End Get
		End Property

		Private _IdDocumento_W As AggregateParameter = Nothing
		Private _TipoDocumento_W As AggregateParameter = Nothing
		Private _RangoInicio_W As AggregateParameter = Nothing
		Private _RangoFin_W As AggregateParameter = Nothing
		Private _RangoActual_W As AggregateParameter = Nothing
		Private _CodUsuario_W As AggregateParameter = Nothing
		Private _FechaActualizacion_W As AggregateParameter = Nothing
		Private _Habilitado_W As AggregateParameter = Nothing
		Private _Vto_W As AggregateParameter = Nothing
		Private _Prefijo_W As AggregateParameter = Nothing

		Public Sub AggregateClauseReset()

		_IdDocumento_W = Nothing
		_TipoDocumento_W = Nothing
		_RangoInicio_W = Nothing
		_RangoFin_W = Nothing
		_RangoActual_W = Nothing
		_CodUsuario_W = Nothing
		_FechaActualizacion_W = Nothing
		_Habilitado_W = Nothing
		_Vto_W = Nothing
		_Prefijo_W = Nothing
			Me._entity.Query.FlushAggregateParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffAggregateParameter
    End Class	

	Public ReadOnly Property Aggregate() As AggregateClause
		Get
			If _aggregateClause Is Nothing Then
				_aggregateClause = New AggregateClause(Me)
			End If
	
			Return _aggregateClause
		End Get
	End Property
	
	Private _aggregateClause As AggregateClause = Nothing	
#End Region	

	Protected Overrides Function GetInsertCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_RANGODOCUMENTOSInsert]" 
	    
		CreateParameters(cmd)
		
		Dim p As SqlParameter
		p = cmd.Parameters(Parameters.IdDocumento.ParameterName)
		p.Direction = ParameterDirection.Output
    
		Return cmd 

  	End Function
	
	Protected Overrides Function GetUpdateCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_RANGODOCUMENTOSUpdate]" 
		
		CreateParameters(cmd) 
		    
		Return cmd
	
	End Function	
	
	Protected Overrides Function GetDeleteCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_RANGODOCUMENTOSDelete]" 
		
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.IdDocumento)
		p.SourceColumn = ColumnNames.IdDocumento
		p.SourceVersion = DataRowVersion.Current

  
		Return cmd
	
	End Function	
	
	Private Sub CreateParameters(ByVal cmd As SqlCommand)
	
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.IdDocumento)
		p.SourceColumn = ColumnNames.IdDocumento
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.TipoDocumento)
		p.SourceColumn = ColumnNames.TipoDocumento
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.RangoInicio)
		p.SourceColumn = ColumnNames.RangoInicio
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.RangoFin)
		p.SourceColumn = ColumnNames.RangoFin
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.RangoActual)
		p.SourceColumn = ColumnNames.RangoActual
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodUsuario)
		p.SourceColumn = ColumnNames.CodUsuario
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.FechaActualizacion)
		p.SourceColumn = ColumnNames.FechaActualizacion
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Habilitado)
		p.SourceColumn = ColumnNames.Habilitado
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Vto)
		p.SourceColumn = ColumnNames.Vto
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Prefijo)
		p.SourceColumn = ColumnNames.Prefijo
		p.SourceVersion = DataRowVersion.Current


	End Sub	

End Class

End NameSpace

